package com.aispeech.asr.webase.seaweedfs.client;

import com.aispeech.asr.webase.seaweedfs.client.request.AssignParams;
import com.aispeech.asr.webase.seaweedfs.client.request.Manifest;
import com.aispeech.asr.webase.seaweedfs.client.response.status.MasterStatus;
import com.aispeech.asr.webase.seaweedfs.client.response.status.VolumeStatus;
import org.springframework.core.io.Resource;
import org.springframework.core.io.buffer.DataBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.io.File;

public interface SeaWeedFSClient {
    static SeaWeedFSClientBuilder createBuilder() {
        return new SeaWeedFSClientBuilder();
    }

    Mono<Assignation> assign();

    Mono<Assignation> assign(AssignParams params);

    Mono<Integer> write(Assignation assignation, File file);

    Mono<Integer> write(Assignation assignation, DataBuffer buffer);

    Mono<Integer> write(Assignation assignation, String text);

    Mono<Assignation> merge(Manifest manifest);

    Mono<Void> delete(WeedFSFile file, Location location);

    Flux<Location> lookup(long volumeId);

    Mono<Resource> read(WeedFSFile file, Location location);

    Mono<MasterStatus> getMasterStatus();

    Mono<VolumeStatus> getVolumeStatus(Location location);
}
